package cn.jly.spring.jdbc.bean;

import java.util.Objects;

/**
 * @author lanyangji
 * @description student类
 * @date 2020/11/11 上午 10:41
 */
public class Student {
    private Integer id;
    private String name;
    private Integer gender;
    private Integer grade;

    public Student() {
    }

    public Student(Integer id, String name, Integer gender, Integer grade) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.grade = grade;
    }

    public Student(String name, Integer gender, Integer grade) {
        this.name = name;
        this.gender = gender;
        this.grade = grade;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        Student student = (Student) o;
        return id.equals(student.id) &&
                name.equals(student.name) &&
                gender.equals(student.gender) &&
                grade.equals(student.grade);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, gender, grade);
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", gender=" + gender +
                ", grade=" + grade +
                '}';
    }
}
